package com.yijinsuo.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;

import com.yijinsuo.R;
import com.yijinsuo.base.BaseActivity;
import com.yijinsuo.mian.MainActivity;
import com.yijinsuo.tool.StatusBarUtil;


/**
 *
 * yihuangxing 启动页
 */
public class WeclomeActivity extends BaseActivity {
    private final long TIME = 1000;
    private boolean flag;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        StatusBarUtil.setTranslucent(this,0);
        setContentView(R.layout.activity_weclome);


    }

    @Override
    protected void initTitle() {
        flag = (Boolean) mpreferencesUtils.get(WeclomeActivity.this, "first", false);
    }

    @Override
    protected void initView() {
        //
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                if(!flag){
                    startActivity(new Intent(WeclomeActivity.this, SplashActivity.class));
                    finish();
                }else {
                    startActivity(new Intent(WeclomeActivity.this,MainActivity.class));
                    overridePendingTransition(R.anim.in_from_right,
                            R.anim.out_to_left);
                    finish();
                }
            }
        },TIME);

    }

    @Override
    protected void setData() {
    }

    @Override
    public void widgetClick(View v) {

    }
}
